<?php



/**
 * This class defines the structure of the 'provinces' table.
 *
 *
 *
 * This map class is used by Propel to do runtime db structure discovery.
 * For example, the createSelectSql() method checks the type of a given column used in an
 * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
 * (i.e. if it's a text column type).
 *
 * @package    propel.generator.nawragon.map
 */
class ProvincesTableMap extends TableMap
{

    /**
     * The (dot-path) name of this class
     */
    const CLASS_NAME = 'nawragon.map.ProvincesTableMap';

    /**
     * Initialize the table attributes, columns and validators
     * Relations are not initialized by this method since they are lazy loaded
     *
     * @return void
     * @throws PropelException
     */
    public function initialize()
    {
        // attributes
        $this->setName('provinces');
        $this->setPhpName('Provinces');
        $this->setClassname('Provinces');
        $this->setPackage('nawragon');
        $this->setUseIdGenerator(true);
        // columns
        $this->addPrimaryKey('id', 'Id', 'INTEGER', true, null, null);
        $this->addForeignKey('game_id', 'GameId', 'INTEGER', 'players', 'game_id', true, null, null);
        $this->addForeignKey('player_id', 'PlayerId', 'INTEGER', 'players', 'id', true, null, null);
        $this->addForeignKey('province_def_id', 'ProvinceDefId', 'INTEGER', 'province_defs', 'id', true, null, null);
        $this->addColumn('active', 'Active', 'TINYINT', true, null, 1);
        // validators
    } // initialize()

    /**
     * Build the RelationMap objects for this table relationships
     */
    public function buildRelations()
    {
        $this->addRelation('ProvinceDefs', 'ProvinceDefs', RelationMap::MANY_TO_ONE, array('province_def_id' => 'id', ), 'RESTRICT', 'RESTRICT');
        $this->addRelation('Players', 'Players', RelationMap::MANY_TO_ONE, array('player_id' => 'id', 'game_id' => 'game_id', ), 'RESTRICT', 'RESTRICT');
        $this->addRelation('Army', 'Army', RelationMap::ONE_TO_MANY, array('id' => 'province_id', ), 'RESTRICT', 'RESTRICT', 'Armys');
        $this->addRelation('Infrastructures', 'Infrastructures', RelationMap::ONE_TO_MANY, array('id' => 'province_id', ), 'RESTRICT', 'RESTRICT', 'Infrastructuress');
        $this->addRelation('Materials', 'Materials', RelationMap::ONE_TO_MANY, array('id' => 'province_id', ), 'RESTRICT', 'RESTRICT', 'Materialss');
        $this->addRelation('ProvinceHistories', 'ProvinceHistories', RelationMap::ONE_TO_MANY, array('id' => 'province_id', ), 'RESTRICT', 'RESTRICT', 'ProvinceHistoriess');
        $this->addRelation('WarRelatedByAttackerProvinceId', 'War', RelationMap::ONE_TO_MANY, array('id' => 'attacker_province_id', ), 'RESTRICT', 'RESTRICT', 'WarsRelatedByAttackerProvinceId');
        $this->addRelation('WarRelatedByOpponentProvinceId', 'War', RelationMap::ONE_TO_MANY, array('id' => 'opponent_province_id', ), 'RESTRICT', 'RESTRICT', 'WarsRelatedByOpponentProvinceId');
    } // buildRelations()

} // ProvincesTableMap
